git push -u origin master# Git for Windows 自动安装脚本

Write-Host "=== Git for Windows 安装脚本 ===" -ForegroundColor Green
Write-Host ""

# 检查是否已安装Git
try {
    git --version | Out-Null
    Write-Host "✅ Git 已安装: $(git --version)" -ForegroundColor Green
    Write-Host ""
    Write-Host "=== 开始同步到Gitee ===" -ForegroundColor Cyan
    
    # 进入项目目录
    Set-Location "D:\work\task\riscv\cursor"
    
    # 检查Git仓库状态
    if (Test-Path ".git") {
        Write-Host "✅ Git仓库已初始化" -ForegroundColor Green
        
        # 添加远程仓库
        git remote add origin https://gitee.com/Antelope693/whu-cs-os.git
        
        # 设置分支名为main
        git branch -M main
        
        # 推送到Gitee
        Write-Host "正在推送到Gitee..." -ForegroundColor Yellow
        git push -u origin main
        
        Write-Host "✅ 同步完成！" -ForegroundColor Green
        Write-Host "项目地址: https://gitee.com/Antelope693/whu-cs-os" -ForegroundColor Cyan
    } else {
        Write-Host "❌ Git仓库未初始化" -ForegroundColor Red
        Write-Host "请先运行: git init" -ForegroundColor Yellow
    }
    
} catch {
    Write-Host "❌ Git 未安装" -ForegroundColor Red
    Write-Host ""
    Write-Host "=== 安装Git for Windows ===" -ForegroundColor Cyan
    Write-Host "1. 访问: https://git-scm.com/download/win" -ForegroundColor Yellow
    Write-Host "2. 下载并安装Git for Windows" -ForegroundColor Yellow
    Write-Host "3. 安装完成后重新运行此脚本" -ForegroundColor Yellow
    Write-Host ""
    Write-Host "或者使用Gitee网页端上传文件" -ForegroundColor Green
}

